package com.cxyzy.demo

import android.net.Uri
import android.os.Bundle
import android.widget.MediaController
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_original.*

class OriginalActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_original)
        playVideo(R.raw.test_video)
    }

    private fun playVideo(rawFileId: Int) {
        val filePath = "android.resource://$packageName/$rawFileId"
        val mediaController = MediaController(this)
        videoView.setMediaController(mediaController)
        videoView.setVideoURI(Uri.parse(filePath))
        videoView.start()
    }

}
